package domain;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Set;


/**
 * The persistent class for the reis database table.
 * 
 */
@Entity
@Table(name="reis")
@NamedQueries({
    @NamedQuery(name = "Reis.findAll", query = "SELECT r FROM Reis r WHERE r.historie=0 ORDER BY r.reistype"),
    @NamedQuery(name = "Reis.findByReistype", query = "SELECT r FROM Reis r WHERE r.historie=0 AND r.reistype LIKE :reistype ORDER BY r.reistype"),
    @NamedQuery(name = "Reis.findByReisId", query = "SELECT r FROM Reis r WHERE r.reisId = :reis_id")})
public class Reis implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="reis_id", unique=true, nullable=false)
	private int reisId;

	@Column(nullable=false)
	private int aantaldagen;

    @Lob()
	@Column(nullable=false)
	private String beschrijving;

	@Column(nullable=false)
	private int betaaltermijn;

	@Column(nullable=false)
	private byte historie;

	@Column(nullable=true, length=255)
	private String image;

	@Column(name="max_leeftijd", nullable=false)
	private int maxLeeftijd;

	@Column(nullable=false, length=50)
	private String reistype;

	//bi-directional many-to-one association to Planning
	@OneToMany(mappedBy="reis", fetch=FetchType.EAGER)
	private Set<Planning> planningen;

	//uni-directional many-to-one association to Land
    @ManyToOne
	@JoinColumn(name="land_id", nullable=false)
	private Land land;

    public Reis() {
    }

	public int getReisId() {
		return this.reisId;
	}

	public void setReisId(int reisId) {
		this.reisId = reisId;
	}

	public int getAantaldagen() {
		return this.aantaldagen;
	}

	public void setAantaldagen(int aantaldagen) {
		this.aantaldagen = aantaldagen;
	}

	public String getBeschrijving() {
		return this.beschrijving;
	}

	public void setBeschrijving(String beschrijving) {
		this.beschrijving = beschrijving;
	}

	public int getBetaaltermijn() {
		return this.betaaltermijn;
	}

	public void setBetaaltermijn(int betaaltermijn) {
		this.betaaltermijn = betaaltermijn;
	}

	public byte getHistorie() {
		return this.historie;
	}

	public void setHistorie(byte historie) {
		this.historie = historie;
	}

	public String getImage() {
		return this.image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public int getMaxLeeftijd() {
		return this.maxLeeftijd;
	}

	public void setMaxLeeftijd(int maxLeeftijd) {
		this.maxLeeftijd = maxLeeftijd;
	}

	public String getReistype() {
		return this.reistype;
	}

	public void setReistype(String reistype) {
		this.reistype = reistype;
	}

	public Set<Planning> getPlanningen() {
		return this.planningen;
	}

	public void setPlanningen(Set<Planning> planningen) {
		this.planningen = planningen;
	}
	
	public Land getLand() {
		return this.land;
	}

	public void setLand(Land land) {
		this.land = land;
	}

	@Override
	public boolean equals(Object obj) {
		return (obj!=null && obj instanceof Reis && ((Reis)obj).getReisId()==getReisId());
	}

	@Override
	public String toString() {
		return getReistype();
	}
}